package com.cdxy.dmr.repository;

import com.cdxy.dmr.dataObject.SceneAttrDO;
import com.cdxy.dmr.mapper.SceneAttrMapper;
import com.cdxy.model.dto.base.mybatis.BaseRepository;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 景点属性表 服务实现类
 * </p>
 *
 * @author autoGenCode
 * @since 2020-03-05
 */
@Repository
@CacheConfig(cacheNames = "scene_attr")
public class SceneAttrRepository extends BaseRepository<SceneAttrMapper, SceneAttrDO> {
    /**
     * 通过景点id
     *
     * @param sceneId
     * @return
     */
    @Cacheable(key = "#sceneId")
    public List<SceneAttrDO> listBySceneId(Integer sceneId) {
        return this.baseMapper.selectList(this.queryWrapper().eq(SceneAttrDO::getSceneId, sceneId));
    }

}
